/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.xulapa.dao.toplink;

import br.com.xulapa.dao.MarcaDAO;
import br.com.xulapa.domain.Marca;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author brunolellis
 */
public class MarcaDAOImpl implements MarcaDAO {

    @PersistenceContext
    private EntityManager em;

    public Marca create(Marca marca) {
        em.persist(marca);
        return marca;

    }

    public void update(Marca marca) {
        em.merge(marca);
    }

    public List<Marca> findAll() {
        Query query = em.createNamedQuery("Marca.findAll");
        return query.getResultList();

    }



}
